import Vue from 'vue'
import Vuex from 'vuex'
import StoreDemo from './modules/StoreDemo'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        count: 0
    },
    mutations: {
        add(state, step) {
            if (step) {
                state.count += step
            } else {
                state.count++
            }
        },
        reduce(state, step) {
            if (step) {
                state.count -= step
            } else {
                state.count--
            }
        }
    },
    moudles: {
        StoreDemo: StoreDemo
    }
})
